#include <stdio.h>//汉诺塔的解法
int hanoi(int n, char a, char b, char c){
    static int steps=0;
    if(n==1){
        printf("%d:%c->%c\n",n,a,c);
    }
    else{
        hanoi(n-1,a,c,b);
        printf("%d:%c->%c\n",n,a,c);
        hanoi(n-1,b,a,c);
    }
    steps++;
    return steps;
}
int main(){
    int n;
    scanf("%d",&n);
    int sum = hanoi(n,'a','b','c');
    printf("次数：%d",sum);
    return 0;
}